/**
 * 详情对话框
 */
var FactoryInfoDlg = {
    data: {
        name: "",
        title: "",
        description: "",
        weigh: "",
        headpic: "",
        status: "",
        createTime: "",
        updateTime: "",
        recordStatus: ""
    }
};

layui.use(['form', 'admin', 'ax','simTool'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var simTool = layui.simTool;


    var sim = new simTool("/upload","#picBox");
    sim.uploadImg()
    //获取详情信息，填充表单


    //表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var ajax = new $ax(Feng.ctxPath + "/factory/addItem", function (data) {
            Feng.success("添加成功！");

            //传给上个页面，刷新table用
            admin.putTempData('formOk', true);
            //关掉对话框
            admin.closeThisDialog();
        }, function (data) {
            Feng.error("添加失败！" + data.responseJSON.message)
        });
        form.render()
        ajax.set("status",$("#status").attr("checked")=="checked"?1:0);
        ajax.set(data.field);
        ajax.start();
    });
});